<template lang="pug">
  ModuleWrapper(title="三资监管资金" flex="1")
    .chart-wrap(ref="chart")
</template>

<script>
export default {
  name: "ModuleMedicalData",
  data() {
    return {
      chart: null,
      data: [
        {
          label: '总人口',
          value: 0,
        },
        {
          label: '农业人口',
          value: 0,
        },
        {
          label: '新型职业农民',
          value: 0,
        },
        {
          label: '产业工人',
          value: 0,
        },
      ]
    }
  },
  methods: {
    renderChart() {
      this.chart = this.$echarts.init(this.$refs['chart']);
      this.chart.setOption({

        color: ['#1860d0', '#45c761', '#1bd8bb', '#8ad10c', ],
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'shadow'
          },
        },
        xAxis: {
          type: 'category',
          data: ['2016', '2017', '2018', '2019', '2020'],
          splitLine: false
        },
        yAxis: {
          type: 'value',
          splitLine: {
            lineStyle: {
              color: ['rgba(255, 255, 255, .25)']
            }
          }
        },
		legend: {
		  data: ['村委会资金（万元）', '组级资金（万元）'],
		  textStyle: {
		    color: '#FFF',
		  }
		},
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          top: '15%',
          containLabel: true
        },
        series: [
          {
            name: "村委会资金（万元）",
            stack: 'total',
            data: [2887.03, 2997.71, 2885.35, 4834.61, 5026.05],
            type: 'bar',
            barWidth: 40, //柱图宽度
			label:{
				show:true,
				position:"top",
				textStyle:{
					color:"#fff"
				}
			}
          },
          {
            name: "组级资金（万元）",
            stack: 'total',
            data: [6267.86, 10345.93, 8993.17, 8770.25, 11682.65],
            type: 'bar',
            barWidth: 40, //柱图宽度
			label:{
				show:true,
				position:"top",
				textStyle:{
					color:"#fff"
				}
			}
          }
        ]
      });
    },
  },
  mounted() {
    this.$nextTick(() => {
      this.renderChart();
    });
  }
}
</script>

<style lang="scss" scoped>
.module{
  width: 98%;
  height: rem(100);
  display: flex;
  margin: 0px auto;
  background-color: rgba($color: #ffff, $alpha: 0.15);
  .chart-wrap{
    flex: 1;
  }
}
</style>
